| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

BufferView.h
1 // BufferView.h
3 //
5
6 namespace nkMemory
7 {
16 template <typename T = unsigned char>
17 class BufferView
18 {
19 public :
20
21 // Constructors, destructor
25 BufferView () noexcept ;
33 BufferView (T* data, unsigned long long size) noexcept ;
40 BufferView (const Buffer& buffer) noexcept ;
49 BufferView (const Buffer& buffer, unsigned long long index, unsigned long long length = 0) noexcept ;
56 BufferView (Buffer&& buffer) = delete ;
57
58 public :
59
60 // Getters
64 T* getData () const ;
68 unsigned long long getSize () const ;
72 unsigned long long getByteSize () const
76 bool empty () const ;
80 T& front () ;
84 const T& front () const ;
88 T& back () ;
92 const T& back () const ;
96 T* begin () ;
100 const T* begin () const ;
104 T* end () ;
108 const T* end () const ;
109
110 public :
111
112 // Conversions
120 BufferView<T> subView (unsigned long long index, unsigned long long length = 0) const ;
121
122 public :
123
124 // Operators
131 T& operator[] (unsigned long long index) ;
138 const T& operator[] (unsigned long long index) const ;
144 BufferView<T>& operator= (const BufferView<T>& other) noexcept ;
150 BufferView<T>& operator= (BufferView<T>&& other) noexcept ;
151
152 public :
153
154 // Constructors templated
160 template <typename U>
161 BufferView (const BufferCast<U>& bufferCast) noexcept ;
167 BufferView (const BufferCast<T>& bufferCast) noexcept ;
173 template <typename U>
174 BufferView (const BufferView<U>& view) noexcept ;
180 BufferView (const BufferView<T>& view) noexcept ;
186 BufferView (BufferView<T>&& other) noexcept ;
192 template <typename U, std::size_t S>
193 BufferView (std::array<U, S>& array) noexcept ;
199 template <std::size_t S>
200 BufferView (std::array<T, S>& array) noexcept ;
206 template <typename U>
207 BufferView (std::vector<U>& vec) noexcept ;
213 explicit BufferView (std::vector<T>& vec) noexcept ;
214
222 template <typename U, std::size_t S, typename = std::enable_if<std::is_const<T>::value>>
223 BufferView (const std::array<U, S>& array) noexcept ;
231 template <std::size_t S, typename = std::enable_if<std::is_const<T>::value>>
232 BufferView (const std::array<typename std::remove_const<T>::type, S>& array) noexcept ;
240 template <typename U, typename = std::enable_if<std::is_const<T>::value>>
241 BufferView (const std::vector<U>& vec) noexcept ;
249 template <typename = std::enable_if<std::is_const<T>::value>>
250 BufferView (const std::vector<typename std::remove_const<T>::type>& vec) noexcept ;
251
252 public :
253
254 // Conversion operators
259 operator Buffer () const ;
260
265 template <typename U = T>
266 operator BufferCast<U> () const ;
267 } ;
268 }
nkMemory::BufferView::end
T * end()
nkMemory::BufferView
A view over data.
Definition: BufferView.h:18
nkMemory::BufferView::begin
T * begin()
nkMemory::BufferView::getData
T * getData() const
nkMemory::BufferView::getByteSize
unsigned long long getByteSize() const bool empty() const
nkMemory::BufferView::back
T & back()
nkMemory::BufferView::getSize
unsigned long long getSize() const
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkMemory::BufferView::BufferView
BufferView() noexcept
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::BufferView::front
T & front()
nkMemory::BufferView::subView
BufferView< T > subView(unsigned long long index, unsigned long long length=0) const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7